import time


def read1(name):
    file = open(name, "r")
    data = file.readlines()
    return data


def sort(my_list):
    for i in range(len(my_list)):
        for in_element in range(1, len(my_list)):
            if my_list[in_element] < my_list[in_element - 1]:
                my_list[in_element], my_list[in_element - 1] = my_list[in_element - 1], my_list[in_element]
    return my_list


m1 = read1("m1_sorted.txt")
m2 = read1("m2_reverse.txt")
m3 = read1("m3_shuffle.txt")

start = time.time()
sort(m1)
stop = time.time()
print("m1_sorted.txt", round((stop - start) * 1000), "milliseconds")
start = time.time()
sort(m2)
stop = time.time()
print("m2_sorted.txt", round((stop - start) * 1000), "milliseconds")
start = time.time()
sort(m3)
stop = time.time()
print("m3_sorted.txt", round((stop - start) * 1000), "milliseconds")
